\(\int \csc ^5(e+f x) (a+b \tan ^2(e+f x)) \, dx\) [35]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 79 \[ \int \csc ^5(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=-\frac {3 (a+4 b) \text {arctanh}(\cos (e+f x))}{8 f}-\frac {(5 a+4 b) \cot (e+f x) \csc (e+f x)}{8 f}-\frac {a \cot ^3(e+f x) \csc (e+f x)}{4 f}+\frac {b \sec (e+f x)}{f} \]

[Out]

-3/8*(a+4*b)*arctanh(cos(f*x+e))/f-1/8*(5*a+4*b)*cot(f*x+e)*csc(f*x+e)/f-1/4*a*cot(f*x+e)^3*csc(f*x+e)/f+b*sec
(f*x+e)/f

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {3745, 466, 1171, 396, 213} \[ \int \csc ^5(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=-\frac {3 (a+4 b) \text {arctanh}(\cos (e+f x))}{8 f}-\frac {(5 a+4 b) \cot (e+f x) \csc (e+f x)}{8 f}-\frac {a \cot ^3(e+f x) \csc (e+f x)}{4 f}+\frac {b \sec (e+f x)}{f} \]

[In]

Int[Csc[e + f*x]^5*(a + b*Tan[e + f*x]^2),x]

[Out]

(-3*(a + 4*b)*ArcTanh[Cos[e + f*x]])/(8*f) - ((5*a + 4*b)*Cot[e + f*x]*Csc[e + f*x])/(8*f) - (a*Cot[e + f*x]^3
*Csc[e + f*x])/(4*f) + (b*Sec[e + f*x])/f

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 396

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[d*x*((a + b*x^n)^(p + 1)/(b*(n*(
p + 1) + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(b*(n*(p + 1) + 1)), Int[(a + b*x^n)^p, x], x] /; FreeQ[{
a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && NeQ[n*(p + 1) + 1, 0]

Rule 466

Int[(x_)^(m_)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2), x_Symbol] :> Simp[(-a)^(m/2 - 1)*(b*c - a*d)*x
*((a + b*x^2)^(p + 1)/(2*b^(m/2 + 1)*(p + 1))), x] + Dist[1/(2*b^(m/2 + 1)*(p + 1)), Int[(a + b*x^2)^(p + 1)*E
xpandToSum[2*b*(p + 1)*x^2*Together[(b^(m/2)*x^(m - 2)*(c + d*x^2) - (-a)^(m/2 - 1)*(b*c - a*d))/(a + b*x^2)]
- (-a)^(m/2 - 1)*(b*c - a*d), x], x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && LtQ[p, -1] && IGtQ[
m/2, 0] && (IntegerQ[p] || EqQ[m + 2*p + 1, 0])

Rule 1171

Int[((d_) + (e_.)*(x_)^2)^(q_)*((a_) + (b_.)*(x_)^2 + (c_.)*(x_)^4)^(p_.), x_Symbol] :> With[{Qx = PolynomialQ
uotient[(a + b*x^2 + c*x^4)^p, d + e*x^2, x], R = Coeff[PolynomialRemainder[(a + b*x^2 + c*x^4)^p, d + e*x^2,
x], x, 0]}, Simp[(-R)*x*((d + e*x^2)^(q + 1)/(2*d*(q + 1))), x] + Dist[1/(2*d*(q + 1)), Int[(d + e*x^2)^(q + 1
)*ExpandToSum[2*d*(q + 1)*Qx + R*(2*q + 3), x], x], x]] /; FreeQ[{a, b, c, d, e}, x] && NeQ[b^2 - 4*a*c, 0] &&
 NeQ[c*d^2 - b*d*e + a*e^2, 0] && IGtQ[p, 0] && LtQ[q, -1]

Rule 3745

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Sec[e + f*x], x]}, Dist[1/(f*ff^m), Subst[Int[(-1 + ff^2*x^2)^((m - 1)/2)*((a - b + b*ff^2*x^2)^p/x^(m
 + 1)), x], x, Sec[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \frac {x^4 \left (a-b+b x^2\right )}{\left (-1+x^2\right )^3} \, dx,x,\sec (e+f x)\right )}{f} \\ & = -\frac {a \cot ^3(e+f x) \csc (e+f x)}{4 f}-\frac {\text {Subst}\left (\int \frac {-a-4 a x^2-4 b x^4}{\left (-1+x^2\right )^2} \, dx,x,\sec (e+f x)\right )}{4 f} \\ & = -\frac {(5 a+4 b) \cot (e+f x) \csc (e+f x)}{8 f}-\frac {a \cot ^3(e+f x) \csc (e+f x)}{4 f}-\frac {\text {Subst}\left (\int \frac {-3 a-4 b-8 b x^2}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{8 f} \\ & = -\frac {(5 a+4 b) \cot (e+f x) \csc (e+f x)}{8 f}-\frac {a \cot ^3(e+f x) \csc (e+f x)}{4 f}+\frac {b \sec (e+f x)}{f}+\frac {(3 (a+4 b)) \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{8 f} \\ & = -\frac {3 (a+4 b) \text {arctanh}(\cos (e+f x))}{8 f}-\frac {(5 a+4 b) \cot (e+f x) \csc (e+f x)}{8 f}-\frac {a \cot ^3(e+f x) \csc (e+f x)}{4 f}+\frac {b \sec (e+f x)}{f} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(276\) vs. \(2(79)=158\).

Time = 6.37 (sec) , antiderivative size = 276, normalized size of antiderivative = 3.49 \[ \int \csc ^5(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=-\frac {3 a \csc ^2\left (\frac {1}{2} (e+f x)\right )}{32 f}-\frac {b \csc ^2\left (\frac {1}{2} (e+f x)\right )}{8 f}-\frac {a \csc ^4\left (\frac {1}{2} (e+f x)\right )}{64 f}-\frac {3 a \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )}{8 f}-\frac {3 b \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}+\frac {3 a \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )}{8 f}+\frac {3 b \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}+\frac {3 a \sec ^2\left (\frac {1}{2} (e+f x)\right )}{32 f}+\frac {b \sec ^2\left (\frac {1}{2} (e+f x)\right )}{8 f}+\frac {a \sec ^4\left (\frac {1}{2} (e+f x)\right )}{64 f}+\frac {b \sin \left (\frac {1}{2} (e+f x)\right )}{f \left (\cos \left (\frac {1}{2} (e+f x)\right )-\sin \left (\frac {1}{2} (e+f x)\right )\right )}-\frac {b \sin \left (\frac {1}{2} (e+f x)\right )}{f \left (\cos \left (\frac {1}{2} (e+f x)\right )+\sin \left (\frac {1}{2} (e+f x)\right )\right )} \]

[In]

Integrate[Csc[e + f*x]^5*(a + b*Tan[e + f*x]^2),x]

[Out]

(-3*a*Csc[(e + f*x)/2]^2)/(32*f) - (b*Csc[(e + f*x)/2]^2)/(8*f) - (a*Csc[(e + f*x)/2]^4)/(64*f) - (3*a*Log[Cos
[(e + f*x)/2]])/(8*f) - (3*b*Log[Cos[(e + f*x)/2]])/(2*f) + (3*a*Log[Sin[(e + f*x)/2]])/(8*f) + (3*b*Log[Sin[(
e + f*x)/2]])/(2*f) + (3*a*Sec[(e + f*x)/2]^2)/(32*f) + (b*Sec[(e + f*x)/2]^2)/(8*f) + (a*Sec[(e + f*x)/2]^4)/
(64*f) + (b*Sin[(e + f*x)/2])/(f*(Cos[(e + f*x)/2] - Sin[(e + f*x)/2])) - (b*Sin[(e + f*x)/2])/(f*(Cos[(e + f*
x)/2] + Sin[(e + f*x)/2]))

Maple [A] (verified)

Time = 1.05 (sec) , antiderivative size = 102, normalized size of antiderivative = 1.29

method result size
derivativedivides \(\frac {a \left (\left (-\frac {\csc \left (f x +e \right )^{3}}{4}-\frac {3 \csc \left (f x +e \right )}{8}\right ) \cot \left (f x +e \right )+\frac {3 \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{8}\right )+b \left (-\frac {1}{2 \sin \left (f x +e \right )^{2} \cos \left (f x +e \right )}+\frac {3}{2 \cos \left (f x +e \right )}+\frac {3 \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) \(102\)
default \(\frac {a \left (\left (-\frac {\csc \left (f x +e \right )^{3}}{4}-\frac {3 \csc \left (f x +e \right )}{8}\right ) \cot \left (f x +e \right )+\frac {3 \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{8}\right )+b \left (-\frac {1}{2 \sin \left (f x +e \right )^{2} \cos \left (f x +e \right )}+\frac {3}{2 \cos \left (f x +e \right )}+\frac {3 \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) \(102\)
risch \(\frac {{\mathrm e}^{i \left (f x +e \right )} \left (3 a \,{\mathrm e}^{8 i \left (f x +e \right )}+12 b \,{\mathrm e}^{8 i \left (f x +e \right )}-8 a \,{\mathrm e}^{6 i \left (f x +e \right )}-32 b \,{\mathrm e}^{6 i \left (f x +e \right )}-22 a \,{\mathrm e}^{4 i \left (f x +e \right )}+40 b \,{\mathrm e}^{4 i \left (f x +e \right )}-8 a \,{\mathrm e}^{2 i \left (f x +e \right )}-32 b \,{\mathrm e}^{2 i \left (f x +e \right )}+3 a +12 b \right )}{4 f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{4} \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {3 a \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right )}{8 f}+\frac {3 \ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) b}{2 f}-\frac {3 a \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right )}{8 f}-\frac {3 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) b}{2 f}\) \(237\)

[In]

int(csc(f*x+e)^5*(a+b*tan(f*x+e)^2),x,method=_RETURNVERBOSE)

[Out]

1/f*(a*((-1/4*csc(f*x+e)^3-3/8*csc(f*x+e))*cot(f*x+e)+3/8*ln(csc(f*x+e)-cot(f*x+e)))+b*(-1/2/sin(f*x+e)^2/cos(
f*x+e)+3/2/cos(f*x+e)+3/2*ln(csc(f*x+e)-cot(f*x+e))))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 178 vs. \(2 (73) = 146\).

Time = 0.28 (sec) , antiderivative size = 178, normalized size of antiderivative = 2.25 \[ \int \csc ^5(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {6 \, {\left (a + 4 \, b\right )} \cos \left (f x + e\right )^{4} - 10 \, {\left (a + 4 \, b\right )} \cos \left (f x + e\right )^{2} - 3 \, {\left ({\left (a + 4 \, b\right )} \cos \left (f x + e\right )^{5} - 2 \, {\left (a + 4 \, b\right )} \cos \left (f x + e\right )^{3} + {\left (a + 4 \, b\right )} \cos \left (f x + e\right )\right )} \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) + 3 \, {\left ({\left (a + 4 \, b\right )} \cos \left (f x + e\right )^{5} - 2 \, {\left (a + 4 \, b\right )} \cos \left (f x + e\right )^{3} + {\left (a + 4 \, b\right )} \cos \left (f x + e\right )\right )} \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) + 16 \, b}{16 \, {\left (f \cos \left (f x + e\right )^{5} - 2 \, f \cos \left (f x + e\right )^{3} + f \cos \left (f x + e\right )\right )}} \]

[In]

integrate(csc(f*x+e)^5*(a+b*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

1/16*(6*(a + 4*b)*cos(f*x + e)^4 - 10*(a + 4*b)*cos(f*x + e)^2 - 3*((a + 4*b)*cos(f*x + e)^5 - 2*(a + 4*b)*cos
(f*x + e)^3 + (a + 4*b)*cos(f*x + e))*log(1/2*cos(f*x + e) + 1/2) + 3*((a + 4*b)*cos(f*x + e)^5 - 2*(a + 4*b)*
cos(f*x + e)^3 + (a + 4*b)*cos(f*x + e))*log(-1/2*cos(f*x + e) + 1/2) + 16*b)/(f*cos(f*x + e)^5 - 2*f*cos(f*x
+ e)^3 + f*cos(f*x + e))

Sympy [F]

\[ \int \csc ^5(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\int \left (a + b \tan ^{2}{\left (e + f x \right )}\right ) \csc ^{5}{\left (e + f x \right )}\, dx \]

[In]

integrate(csc(f*x+e)**5*(a+b*tan(f*x+e)**2),x)

[Out]

Integral((a + b*tan(e + f*x)**2)*csc(e + f*x)**5, x)

Maxima [A] (verification not implemented)

none

Time = 0.24 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.28 \[ \int \csc ^5(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=-\frac {3 \, {\left (a + 4 \, b\right )} \log \left (\cos \left (f x + e\right ) + 1\right ) - 3 \, {\left (a + 4 \, b\right )} \log \left (\cos \left (f x + e\right ) - 1\right ) - \frac {2 \, {\left (3 \, {\left (a + 4 \, b\right )} \cos \left (f x + e\right )^{4} - 5 \, {\left (a + 4 \, b\right )} \cos \left (f x + e\right )^{2} + 8 \, b\right )}}{\cos \left (f x + e\right )^{5} - 2 \, \cos \left (f x + e\right )^{3} + \cos \left (f x + e\right )}}{16 \, f} \]

[In]

integrate(csc(f*x+e)^5*(a+b*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

-1/16*(3*(a + 4*b)*log(cos(f*x + e) + 1) - 3*(a + 4*b)*log(cos(f*x + e) - 1) - 2*(3*(a + 4*b)*cos(f*x + e)^4 -
 5*(a + 4*b)*cos(f*x + e)^2 + 8*b)/(cos(f*x + e)^5 - 2*cos(f*x + e)^3 + cos(f*x + e)))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 239 vs. \(2 (73) = 146\).

Time = 0.45 (sec) , antiderivative size = 239, normalized size of antiderivative = 3.03 \[ \int \csc ^5(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {12 \, {\left (a + 4 \, b\right )} \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right ) - \frac {{\left (a - \frac {8 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {8 \, b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {18 \, a {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {72 \, b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) - 1\right )}^{2}} - \frac {8 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {8 \, b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {a {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {128 \, b}{\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1}}{64 \, f} \]

[In]

integrate(csc(f*x+e)^5*(a+b*tan(f*x+e)^2),x, algorithm="giac")

[Out]

1/64*(12*(a + 4*b)*log(abs(-cos(f*x + e) + 1)/abs(cos(f*x + e) + 1)) - (a - 8*a*(cos(f*x + e) - 1)/(cos(f*x +
e) + 1) - 8*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) + 18*a*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2 + 72*b*(c
os(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2)*(cos(f*x + e) + 1)^2/(cos(f*x + e) - 1)^2 - 8*a*(cos(f*x + e) - 1)/(c
os(f*x + e) + 1) - 8*b*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) + a*(cos(f*x + e) - 1)^2/(cos(f*x + e) + 1)^2 + 1
28*b/((cos(f*x + e) - 1)/(cos(f*x + e) + 1) + 1))/f

Mupad [B] (verification not implemented)

Time = 10.25 (sec) , antiderivative size = 138, normalized size of antiderivative = 1.75 \[ \int \csc ^5(e+f x) \left (a+b \tan ^2(e+f x)\right ) \, dx=\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (\frac {a}{8}+\frac {b}{8}\right )}{f}-\frac {\left (-2\,a-34\,b\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4+\left (\frac {7\,a}{4}+2\,b\right )\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+\frac {a}{4}}{f\,\left (16\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4-16\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^6\right )}+\frac {\ln \left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )\,\left (\frac {3\,a}{8}+\frac {3\,b}{2}\right )}{f}+\frac {a\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4}{64\,f} \]

[In]

int((a + b*tan(e + f*x)^2)/sin(e + f*x)^5,x)

[Out]

(tan(e/2 + (f*x)/2)^2*(a/8 + b/8))/f - (a/4 + tan(e/2 + (f*x)/2)^2*((7*a)/4 + 2*b) - tan(e/2 + (f*x)/2)^4*(2*a
 + 34*b))/(f*(16*tan(e/2 + (f*x)/2)^4 - 16*tan(e/2 + (f*x)/2)^6)) + (log(tan(e/2 + (f*x)/2))*((3*a)/8 + (3*b)/
2))/f + (a*tan(e/2 + (f*x)/2)^4)/(64*f)